// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-8-13

#include "stdafx.h"
#include "joy_main.h"
#include "settingdlg.h"
#include "gamesetting.h"
#include "lobbyindex.h"

enum
{
    SETTINGDLG_WIDTH    = 470,
    SETTINGDLG_HEIGHT   = 380,
    SETTINGDLG_ROUND    = 6,
};

// CJoySettingDlg dialog

IMPLEMENT_DYNAMIC(CJoySettingDlg, CDialog)

//##ModelId=44C4B5DC03B9
CJoySettingDlg::CJoySettingDlg(CWnd* pParent, UINT lobbyId)
	: CDialog(CJoySettingDlg::IDD, pParent)
{
    m_lobbyId = lobbyId;
}

//##ModelId=44C4B5DC03BC
CJoySettingDlg::~CJoySettingDlg()
{
}

//##ModelId=44C4B5DC03C9
void CJoySettingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CJoySettingDlg, CDialog)
    ON_WM_CREATE()
    ON_WM_SIZE()
    ON_WM_NCHITTEST()
END_MESSAGE_MAP()


// CJoySettingDlg message handlers

//##ModelId=44C4B5DC03CC
int CJoySettingDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDialog::OnCreate(lpCreateStruct) == -1)
        return -1;

    m_settingWnd.Create(this, CRect(0, 0, 10, 10));
    m_settingWnd.m_gameSetting->m_lobbyIndex->SelectLobby(m_lobbyId);
    return 0;
}

//##ModelId=44C4B5DC03CF
void CJoySettingDlg::OnSize(UINT nType, int cx, int cy)
{
    CDialog::OnSize(nType, cx, cy);

    SetWindowRgn(
        CreateRoundRectRgn(0, 0, cx, cy, SETTINGDLG_ROUND, SETTINGDLG_ROUND),
        TRUE);
    
}

//##ModelId=44C4B5DC03DC
LRESULT CJoySettingDlg::OnNcHitTest(CPoint point)
{
    CDialog::OnNcHitTest(point);
    return HTCAPTION;
}

//##ModelId=44C4B5DC03BE
void CJoySettingDlg::OnCancel()
{
    // TODO: Add your specialized code here and/or call the base class

    CDialog::OnCancel();
}

//##ModelId=44C4B5DC03C0
void CJoySettingDlg::OnOK()
{
    m_settingWnd.OnOK();
    CDialog::OnOK();
}
